package com.xiaoyin.community.Service;

import com.xiaoyin.community.Domain.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by yinjianping@baidu.com on 2018/7/13.
 *
 * @Description:
 * @Modified By:
 */
@Service
public class BookInfoService {
    @Autowired
    private MongoTemplate mongoTemplate;

    public void insert(BookInfo bookInfo){
        mongoTemplate.save(bookInfo);
    }
    public List<BookInfo> findService(){
        Query query = Query.query(Criteria.where("tags").is("计算机"));
        return mongoTemplate.find(query,BookInfo.class);
    }

}
